package com.fis.hthk.dblinkapi.util;



import com.agileitp.forte.framework.GenericException;
import com.agileitp.forte.framework.TextData;

import com.ssaglobal.scm.wms.service.baseobjects.EXEDataObject;
import com.ssaglobal.scm.wms.service.exeprocessmanager.TransactionServiceSORemote;
//import com.ssaglobal.scm.wms.uiextensions.KeyGenBioWrapper;


public class WmsWebuiActionsImpl {
	
	protected static final String internalCaller = "internalCall";	
	
	public static EXEDataObject doAction(String provider, WmsWebuiActionsProperties proParametes) throws Exception{
    	EXEDataObject edo =null;

		try{
				TransactionServiceSORemote remote = EJBRemote.getRemote(provider);				
				
   				edo = remote.executeProcedure(new TextData(proParametes.getUserid()),proParametes.getDbJndi(),new TextData(proParametes.getProcedureName()),proParametes.getProcedureParametes(),null,internalCaller,null);		//HC
   				System.out.println("\n\n edo:"+edo+"\n\n");
   				return edo;
  		} catch (Exception exc) {   			
            	exc.printStackTrace();
            	
            	String reasonCode = "";
                if (exc instanceof GenericException) {
                    reasonCode = ((GenericException) exc).reasonCodeString();
                } else {
                    
                    reasonCode = exc.getMessage();
                    if(reasonCode==null||reasonCode.equals("")){
                    	reasonCode = exc.getCause().getMessage();
                    }
                }             

                
					throw new Exception(reasonCode);
				
            	
        }
	}
	


}
